/**
 * 
 */
package org.mspring.mlog.task.comment.task;

import java.util.HashMap;
import java.util.Map;

import org.mspring.mlog.entity.Comment;
import org.mspring.mlog.service.MessageService;
import org.mspring.platform.task.AbstractTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Gao Youbo
 * @since 2013-1-9
 * @Description
 * @TODO
 */
@Component
public class CommentNoticeTask extends AbstractTask {
    @Autowired
    private MessageService messageService;

    @Override
    protected void doTask(Map<Object, Object> paramMap) {
        // TODO Auto-generated method stub
        if (paramMap != null) {
            Object commentObj = paramMap.get("comment");
            if (commentObj == null) {
                return;
            }
            Comment comment = (Comment) commentObj;
            Map<Object, Object> model = new HashMap<Object, Object>();
            model.put("comment", comment);
            messageService.sendMessage(null, comment.getToUser().getId(), "message/comment_message.ftl", model);
        }
    }
}
